package com.timmy.google_play.holder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.timmy.google_play.R;
import com.timmy.google_play.base.BaseHolder;
import com.timmy.google_play.bean.SubjectBean;
import com.timmy.google_play.conf.Constants;
import com.timmy.google_play.utils.UIUtils;

import butterknife.BindView;
import it.sephiroth.android.library.picasso.Picasso;

/**
 * Created by Timmy on 2016/12/12.
 */
public class SubjectHolder extends BaseHolder<SubjectBean> {
    @BindView(R.id.item_subject_iv_icon)
    ImageView mItemSubjectIvIcon;
    @BindView(R.id.item_subject_tv_title)
    TextView  mItemSubjectTvTitle;

    @Override
    protected View initHolderVIew() {
        return View.inflate(UIUtils.getContext(), R.layout.item_subject, null);
    }

    @Override
    protected void refreshHolderView(SubjectBean data) {

        String des = data.des;
        String url = Constants.URLS.IMAGEBASEURL + data.url;

        mItemSubjectTvTitle.setText(des);
        Picasso.with(UIUtils.getContext()).load(url).into(mItemSubjectIvIcon);
    }
}
